package exceptions;

/**
 * Created by pc on 2015/1/29.
 */
public class AuctionTest {
    private double minBidPrice = 30.0;
    
    public void bid(String bidPrice) throws AuctionException {
        double d = 0.0;
        try{
            d = Double.parseDouble(bidPrice);
        }
        catch (Exception e){
            e.printStackTrace();
            throw new AuctionException("竞拍价格必须是数字！");
        }
        if (minBidPrice > d){
            throw new AuctionException("竞拍价格必须大于起拍价！");
        }
        minBidPrice = d;
        
    }
    
    public static void main (String args[]){
        AuctionTest at = new AuctionTest();
        try {
            at.bid("2");
        } catch (AuctionException e) {
            e.printStackTrace();
        }

    }
}
